home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / mountall.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2008-10-14  |  2KB  |  106 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          mountall
  4. # Required-Start:    checkfs
  5. # Required-Stop: 
  6. # Default-Start:     S
  7. # Default-Stop:
  8. # Short-Description: Mount all filesystems.
  9. # Description:
  10. ### END INIT INFO
  11.  
  12. PATH=/sbin:/bin
  13. . /lib/init/vars.sh
  14.  
  15. . /lib/lsb/init-functions
  16. . /lib/init/mount-functions.sh
  17.  
  18. # for ntfs-3g to get correct file name encoding
  19. if [ -r /etc/default/locale ]; then
  20.     . /etc/default/locale
  21.     export LANG
  22. fi
  23.  
  24. do_start() {
  25.     #
  26.     # Mount local file systems in /etc/fstab.
  27.     #
  28.     mount_all_local() {
  29.         mount -a -t nonfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs,gfs2 \
  30.         -O no_netdev
  31.     }
  32.     pre_mountall
  33.     if [ "$VERBOSE" = no ]
  34.     then
  35.         log_action_begin_msg "Mounting local filesystems"
  36.         mount_all_local
  37.         log_action_end_msg $?
  38.     else
  39.         log_daemon_msg "Will now mount local filesystems"
  40.         mount_all_local
  41.         log_end_msg $?
  42.     fi
  43.     post_mountall
  44.  
  45.     case "$(uname -s)" in
  46.       *FreeBSD)
  47.         INITCTL=/etc/.initctl
  48.         ;;
  49.       *)
  50.         INITCTL=/dev/initctl
  51.         ;;
  52.     esac
  53.  
  54.     #
  55.     # We might have mounted something over /dev, see if
  56.     # /dev/initctl is there.
  57.     #
  58.     if [ ! -p $INITCTL ]
  59.     then
  60.         rm -f $INITCTL
  61.         mknod -m 600 $INITCTL p
  62.     fi
  63.     kill -USR1 1
  64.  
  65.     #
  66.     # Execute swapon command again, in case we want to swap to
  67.     # a file on a now mounted filesystem.
  68.     #
  69.     # Ignore 255 status due to swap already being enabled
  70.     #
  71.     if [ "$NOSWAP" = yes ]
  72.     then
  73.         [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap as requested via bootoption noswap."
  74.     else
  75.         if [ "$VERBOSE" = no ]
  76.         then
  77.             log_action_begin_msg "Activating swapfile swap"
  78.             swapon -a -e 2>/dev/null || :  # Stifle "Device or resource busy"
  79.             log_action_end_msg 0
  80.         else
  81.             log_daemon_msg "Will now activate swapfile swap"
  82.             swapon -a -e -v
  83.             log_action_end_msg $?
  84.         fi
  85.     fi
  86. }
  87.  
  88. case "$1" in
  89.   start|"")
  90.     do_start
  91.     ;;
  92.   restart|reload|force-reload)
  93.     echo "Error: argument '$1' not supported" >&2
  94.     exit 3
  95.     ;;
  96.   stop)
  97.     # No-op
  98.     ;;
  99.   *)
  100.     echo "Usage: mountall.sh [start|stop]" >&2
  101.     exit 3
  102.     ;;
  103. esac
  104.  
  105. :
  106.